package com.hsd.ha.app.vo;

import java.math.BigDecimal;

public class FdtsVo implements Comparable<Object>{
   private String zx_name = "";
   private java.math.BigDecimal zx_id =null;
   private StringBuilder answer_str = new StringBuilder("");
   private java.math.BigDecimal  zx_result = BigDecimal.valueOf(0.0); 
   private java.math.BigDecimal  zx_num = BigDecimal.valueOf(0.0); 

   private int qnum = 0;
   public int getQnum() {
	return qnum;
	}
	public void setQnum(int qnum) {
		this.qnum = qnum;
	}
	public java.math.BigDecimal getZx_num() {
		
		
		return  this.zx_num;
	}
	public void setZx_num(java.math.BigDecimal zx_num) {
		this.zx_num = zx_num;
	}
	
	 
   public void add(BigDecimal val){
	   this.qnum+=1;
	   this.zx_result = this.zx_result.add(val); 
	   this.answer_str.append(val);
	   this.answer_str.append(";");
	   this.zx_num.setScale(8,BigDecimal.ROUND_HALF_EVEN);
//		System.out.println("this.zx_result:" + this.zx_result);
//		System.out.println("this.qnum:" + this.qnum);
		this.zx_num = this.zx_result.divide(new BigDecimal(qnum),8, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100));
		System.out.println("zx_num:" + zx_num);
   }
	public String getZx_name() {
	    return zx_name;
    }

    public void setZx_name(String zx_name) {
	    this.zx_name = zx_name;
    }

	public java.math.BigDecimal getZx_id() {
		return zx_id;
	}
	
	public void setZx_id(java.math.BigDecimal zx_id) {
		this.zx_id = zx_id;
	}
	
	public StringBuilder getAnswer_str() {
		return answer_str;
	}
	
	public void setAnswer_str(StringBuilder answer_str) {
		this.answer_str = answer_str;
	}

	@Override
	public int compareTo(Object o) {
		FdtsVo fv = (FdtsVo)o;
		BigDecimal b1 =  fv.getZx_num();
		BigDecimal b2 = this.getZx_num();  
		 System.out.println("b1:" + b1);
		 System.out.println("b2:" + b2);
		return  b1.compareTo(b2) == 0?1:b1.compareTo(b2);
	}

	public java.math.BigDecimal getZx_result() {
		
		System.out.println("oldvalue:" + this.zx_result); 
		return this.zx_result.setScale(2,BigDecimal.ROUND_HALF_EVEN);
	}

	public void setZx_result(java.math.BigDecimal zx_result) {
		 this.zx_result = zx_result;
	}
   public String toString(){
	   StringBuilder builder = new StringBuilder();
	   builder.append("zx_id:").append(zx_id).append("\r\n");
	   builder.append("zx_name:").append(zx_name).append("\r\n");
	   builder.append("answer_str:").append(answer_str).append("\r\n");
	   builder.append("zx_result:").append(zx_result).append("\r\n");
	   builder.append("zx_num:").append(getZx_num()).append("\r\n"); 
	   builder.append("this.qnum:").append(this.qnum).append("\r\n");
//	   System.out.println("answer_str:" + answer_str);
//	   System.out.println("answer_str:" + answer_str);
	return builder.toString();
   }
	 
}
